package com.ruoyi.camp.service.impl;

import com.ruoyi.camp.domain.CCampFacility;
import com.ruoyi.camp.domain.CFacility;
import com.ruoyi.camp.domain.CFacilityType;
import com.ruoyi.camp.mapper.CCampFacilityMapper;
import com.ruoyi.camp.mapper.CFacilityMapper;
import com.ruoyi.camp.mapper.CFacilityTypeMapper;
import com.ruoyi.camp.service.IWxFacilityService;
import com.ruoyi.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WxFacilityService implements IWxFacilityService {

    @Autowired
    private CFacilityTypeMapper cFacilityTypeMapper;

    //营地服务设施
    @Autowired
    private CCampFacilityMapper cCampFacilityMapper;

    @Override
    public List<CFacilityType> facilityTypeList(CFacilityType cFacilityType) {
       return cFacilityTypeMapper.facilityTypeList(cFacilityType);
    }

    @Override
    public int insertCampFacility(String campId,String[] facilityIds){
        for (String facilityId : facilityIds) {
            CCampFacility campFacility = new CCampFacility();
            campFacility.setCfId(IdUtils.randomUUID());
            campFacility.setCampId(campId);
            campFacility.setFacilityId(facilityId);
            cCampFacilityMapper.insertCCampFacility(campFacility);
        }
        return 1;
    }

}
